home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / TIMEDATE.MOD < prev    next >
Text File  |  1989-01-18  |  2KB  |  57 lines

  1. MODULE TimeDate;
  2.  
  3. (* Note - DOSCALL calls interrupt 21(hex) = 33(dec) which is the   *)
  4. (*        general purpose BIOS interrupt.  It is used for many     *)
  5. (*        operations on the disks, and other peripherals.  See     *)
  6. (*        your DOS manual for details.  Some DOS manuals don't     *)
  7. (*        have any information on this so your next best bet is    *)
  8. (*        Peter Norton's book "Programmers Guide to the IBM-PC.    *)
  9.  
  10. FROM SYSTEM IMPORT DOSCALL;
  11. FROM InOut IMPORT WriteString, WriteCard, WriteLn;
  12.  
  13. VAR MonthDay, Year, Month, Day        : CARDINAL;
  14.     HourMinute, SecondMillisec        : CARDINAL;
  15.     Hour, Minute, Second, Millisecond : CARDINAL;
  16.     Index, Count, Stuff               : CARDINAL;
  17.  
  18. BEGIN
  19.    FOR Index := 1 TO 15 DO
  20.  
  21.       DOSCALL(2AH,Year,MonthDay);    (* Year is alone in a word    *)
  22.       Month := MonthDay DIV 256;     (* Month is in top half       *)
  23.       Day := MonthDay MOD 256;       (* Day is in bottom half      *)
  24.  
  25.       DOSCALL(2CH,HourMinute,SecondMillisec);
  26.       Hour := HourMinute DIV 256;
  27.       Minute := HourMinute MOD 256;
  28.       Second := SecondMillisec DIV 256;
  29.       Millisecond := 10*(SecondMillisec MOD 256); (* actually this *)
  30.                                     (* is in hundredths of seconds *)
  31.  
  32.       WriteString("The time is ");
  33.       WriteCard(Hour,2);
  34.       WriteString(":");
  35.       WriteCard(Minute,2);
  36.       WriteString(":");
  37.       WriteCard(Second,2);
  38.       WriteString(":");
  39.       WriteCard(Millisecond,3);
  40.       WriteString("   ");
  41.       WriteCard(Month,2);
  42.       WriteString("/");
  43.       WriteCard(Day,2);
  44.       WriteString("/");
  45.       WriteCard(Year,4);
  46.       WriteLn;
  47.  
  48.                (* The following loop takes about one second to  *)
  49.                (* finish its full count on an IBM-PC at normal  *)
  50.                (* speed.  It may vary in time for your system.  *)
  51.  
  52.       FOR Count := 1 TO 13300 DO
  53.          Stuff := 32000 DIV Count;
  54.       END;
  55.    END;
  56. END TimeDate.
  57.